package com.my.servlets;

import javax.naming.Name;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(value = "/servlets/WelcomeServlet2",loadOnStartup = 2,initParams = {@WebInitParam(name="WelcomeServlet2Name",value="WelcomeServlet2Value")})
public class WelcomeServlet2 extends HttpServlet {

    @Override
    public void init() throws ServletException {
        String value = super.getInitParameter("WelcomeServlet2Name");
        System.out.println("当前Servlet的参数：" + value);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("WelcomeServlet2...doGet()");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("WelcomeServlet2...doPost()");
    }
}

